﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace OliveAirLeakTest
{
    internal static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //DogCheck.DogCheck dc = new DogCheck.DogCheck();
            //int iResult = dc.Login();
            //if (iResult == 2)
            //{
            //    MessageBox.Show(dc.ErrString);
            //    dc.LoginOut();
            //    Application.Exit();
            //}
            //else
            //{
            //    if (iResult == 1)
            //        MessageBox.Show(dc.ErrString);
            //}
            //dc.LoginOut();
            //Application.Run(new MainFrm());

            bool runone;
            System.Threading.Mutex run = new System.Threading.Mutex(true, "xinbiao_a_test", out runone);
            if (runone)
            {
                run.ReleaseMutex();

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                //DogCheck.DogCheck dc = new DogCheck.DogCheck();
                //int iResult = dc.Login();
                //if (iResult == 2)
                //{
                //    MessageBox.Show(dc.ErrString);
                //    dc.LoginOut();
                //    // Application.Exit();
                //    return;
                //}
                //else
                //{
                //    if (iResult == 1)
                //        MessageBox.Show(dc.ErrString);
                //}
                //dc.LoginOut();
                Application.Run(new MainFrm());

            }
            else
            {
                MessageBox.Show("已经运行了一个实例了。");
            }

        }
    }
}
